<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // a &&= b 的意思就是 a = a&&b
        let a = null;
        let b = true;
        console.log(a &&= 1); //null
        console.log(b &&= false); //false

        console.log('----------------------------------------');

        // a ||= b 的意思就是 a = a || b
        let c = null;
        let d = true;
        console.log(c ||= 1); //1
        console.log(d ||= 0); //true

        console.log('----------------------------------------');

        // a ??= b 的意思就是 a = a ?? b
        let e = 0;
        let f = null;
        console.log(e ??= 'wocao');//0
        console.log(f ??= 'wocao');//wocao
    </script>
</body>

</html>